{% extends "index.html" %}

{% load dajaxice_templatetags %}

{% block scripts %}
	{% dajaxice_js_import %}
	<script type="text/javascript" src="{{ STATIC_URL }}scripts/own/lecturer_autocomplete.js"></script>
	<script type="text/javascript" charset="utf-8">
		$(document).ready(function() {
			autoComplete = new LecturerAutoComplete($("#id_lecturer"), '{{ module_term.module.id }}');
			$('.hint').tooltip({
				position: 'center right',
				effect: 'fade'
			});
		});
	</script>
	
	<!-- make the autocomplete box scrollable -->
	<style>
	.ui-autocomplete {
		max-height: 150px;
		overflow-y: auto;
		/* prevent horizontal scrollbar */
		overflow-x: hidden;
		/* add padding to account for vertical scrollbar */
		padding-right: 20px;
	}
	/* IE 6 doesn't support max-height
	 * we use height instead, but this forces the menu to always be this tall
	 */
	* html .ui-autocomplete {
		height: 150px;
	}
	</style>
{% endblock %}

{% block inline_navi %}
    <a href="{% url documents.views.index %}">
    	Dokumente
   	</a>
    &nbsp;>&nbsp;
    <a href="{% url documents.views.modulelist module_term.module.faculty.id %}">
    	{{ module_term.module.faculty }}
   	</a>
    &nbsp;>&nbsp;
    {{ module_term.module }} ({{ module_term.lecturer.last_name }} - {{ module_term.semester }})
    &nbsp;>&nbsp;
    Verändern
{% endblock %}

{% block box_title %}
	Semester ändern
{% endblock %}
{% block box_content %}
	<p>
	    Hier kannst du das Semester {{ module_term.module }} ({{ module_term.lecturer.last_name }} - {{ module_term.semester }}) ändern.
	</p>
	
	<div id="detail_table">
	    <h3>Semesterformular</h3>
	    <form action="{% url documents.views.change_module_term module_term.id %}" enctype="multipart/form-data" method="post">
	        {% csrf_token %}
	        {{ form.non_field_errors }}
	        <table>
	            <!-- Lecturer -->
	            <tr>
	                {% if form.lecturer.errors %}
	                <th class="form_error"><label for="id_lecturer">Dozent("Nachname, Vorname")* {{ form.lecturer.errors }}</label></th>
	                {% else %}
	                <th><label for="id_lecturer">Dozent("Nachname, Vorname")*:</label></th>
	                {% endif %}
	                <td>{{ form.lecturer }}</td>
	                <td><div class="hint" title="Keinen Titel" /></td>
	            </tr>
	            <!-- Semester -->
	            <tr>
	            	{% if form.semester.errors %}
	                <th class="form_error"><label for="id_semester">Semester* {{ form.semester.errors }}</label></th>
	                {% else %}
	                <th><label for="id_semester">Semester*:</label></th>
	                {% endif %}
	                <td>{{ form.semester }}</td>
	            </tr>
	            <tr>
	                <td colspan="2" align="center" style="padding-top: 10px;">
	                    <input type="submit" value="Ändern" />
	                </td>
	            </tr>
	        </table>
	    </form>
	</div>
{% endblock %}